<template>
  <div style="margin-top: 50px">
    <el-row :gutter="20">
      <el-col :span="12" :offset="6">
        <div class="grid-content bg-purple">
          <el-form ref="form" :model="form" label-width="100px">
            <el-form-item label="停车场类型">
              <el-input type="text" v-model="form.partTypeName" readonly />
            </el-form-item>
            <el-form-item label="是否可用">
              <dict-tag
                :options="dict.type.sys_normal_disable"
                :value="form.sysNormalDisable"
              />
            </el-form-item>
            <el-form-item label="备注">
              <el-input v-model="form.remark" type="textarea" readonly />
            </el-form-item>
            <el-form-item>
              <div
                style="width: 100%; text-align: center"
              >
                <el-button type="primary" style="margin: 0 auto" @click="toPath"
                  >返回</el-button
                >
              </div>
            </el-form-item>
          </el-form>
        </div>
      </el-col>
    </el-row>
    <div>{{partTypeId}}</div>
  </div>
</template>
<script>
import { getType } from "@/api/part/type";

export default {
  name: "Detail",
  dicts: ["sys_normal_disable"],
  data() {
    return {
      partTypeId: "",
      // 表单数据
      form: {},
    };
  },
  //生命周期函数,组件完成之后默认执行created方法
  created() {
    //查询方法
    this.getInfo();
  },
  methods: {
    getInfo() {
      //输出路由信息
      console.log(this.$route);
      //接收前面组件传递过来的值
      let partTypeId = this.$route.params && this.$route.params.partTypeId;
      console.log(partTypeId);
      this.partTypeId = partTypeId;
      getType(partTypeId).then((response) => {
        console.log(response);
        this.form = response.data;
      });
    },
  
    toPath(){
      //关闭当前页签
      this.$tab.closePage();
      this.$router.push({
        path:'/part/type',
      })
    }
  },
};
</script>
